import { reqGetSearchInfo } from '@/api';

const state = {
    searchList: {}
};

const getters = {
    attrsList(state) {
        return state.searchList.attrsList || [];
    },
    goodsList(state) {
        return state.searchList.goodsList || [];
    },
    trademarkList(state) {
        return state.searchList.trademarkList || [];
    }
};

const mutations = {
    GETSEARCHLIST(state,searchList) {
        state.searchList = searchList;
    }
};

const actions = {
    // 获取搜索数据
    async getSearchList({commit},param = {}) {
        let res = await reqGetSearchInfo(param);
        if(res.code == 200) {
            commit('GETSEARCHLIST',res.data);
        }
    }
};

export default {
    state,
    getters,
    mutations,
    actions
}